Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The test lacks a Galera provider sync-point capability check, causing debug servers with non-debug providers to fail rather than skip the unsupported test.
1 open issue
What changed in this PR
Fixes commit handling for replayed write sets with no row events, preventing Galera’s fatal “unexpected trx release state” error after a no-op INSERT ... ON DUPLICATE KEY UPDATE.
Changes:
- Extends the commit-hook fallback to transactions in
s_replaying. - Adds a regression test that forces replay and verifies successful commits, continued replication, and absence of the fatal error.
| File | Description |
|---|---|
sql/wsrep_high_priority_service.cc |
Runs fallback commit hooks for replayed empty write sets. |
mysql-test/suite/galera/t/galera_replay_no_op_trx.test |
Adds deterministic no-op transaction replay coverage. |
mysql-test/suite/galera/r/galera_replay_no_op_trx.result |
Records expected replay and replication results. |
Review effort: Balanced
… a no-op INSERT ... ON DUPLICATE KEY UPDATE https://perconadev.atlassian.net/browse/PXC-5370 Problem: An INSERT ... ON DUPLICATE KEY UPDATE that matches an existing row but does not change it generates no row events. wsrep_compare_records() still appends certification keys for the unchanged row, so a write set with keys but an empty payload is replicated and certified. If such a transaction is BF-aborted after certification (e.g. by a conflicting applier blocked on its next-key lock), it is replayed. Applying the empty payload registers no storage engine, so trans_commit() does not run the wsrep commit hooks and the transaction never enters or leaves the commit order. Wsrep_high_priority_service::commit() already has a fallback that cycles through the commit hooks for this case, but only for the s_executing state (CTAS with an empty result set). A replayer is in s_replaying, so the fallback was skipped. Galera kept the trx in the REPLAYING state and failed in galera_release() with: unexpected trx release state ... MUST_REPLAY->REPLAYING (FATAL) Debug builds hit the assertion ts.state() == TrxHandle::S_COMMITTED in ReplicatorSMM::replay_trx(). Resolution: Apply the same fallback to the s_replaying state, so the replayed empty write set goes through before_commit(), ordered_commit() and after_commit(), which release the commit order and let the provider commit the trx. wsrep-lib already supports s_replaying in before_commit() for high priority clients. Added galera.galera_replay_no_op_trx, which uses Galera sync points to BF-abort and replay a no-op ODKU transaction deterministically. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Replay commit-order correctness and provider-state cleanup depend on wsrep-lib/Galera implementations absent from this snapshot and require debug-provider validation of the regression and existing replay scenarios.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

… a no-op INSERT ... ON DUPLICATE KEY UPDATE
https://perconadev.atlassian.net/browse/PXC-5370
Problem:
An INSERT ... ON DUPLICATE KEY UPDATE that matches an existing row but does not change it generates no row events. wsrep_compare_records() still appends certification keys for the unchanged row, so a write set with keys but an empty payload is replicated and certified.
If such a transaction is BF-aborted after certification (e.g. by a conflicting applier blocked on its next-key lock), it is replayed. Applying the empty payload registers no storage engine, so trans_commit() does not run the wsrep commit hooks and the transaction never enters or leaves the commit order. Wsrep_high_priority_service::commit() already has a fallback that cycles through the commit hooks for this case, but only for the s_executing state (CTAS with an empty result set). A replayer is in s_replaying, so the fallback was skipped. Galera kept the trx in the REPLAYING state and failed in galera_release() with:
unexpected trx release state ... MUST_REPLAY->REPLAYING (FATAL)
Debug builds hit the assertion ts.state() == TrxHandle::S_COMMITTED in ReplicatorSMM::replay_trx().
Resolution:
Apply the same fallback to the s_replaying state, so the replayed empty write set goes through before_commit(), ordered_commit() and after_commit(), which release the commit order and let the provider commit the trx. wsrep-lib already supports s_replaying in before_commit() for high priority clients.
Added galera.galera_replay_no_op_trx, which uses Galera sync points to BF-abort and replay a no-op ODKU transaction deterministically.